package com.xmut.xmutbackend.controller;

import com.xmut.xmutbackend.entity.OperationLog;
import com.xmut.xmutbackend.entity.PageBean;
import com.xmut.xmutbackend.entity.Result;
import com.xmut.xmutbackend.service.IOperationLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 邓仲良
 * @since 2025-06-18
 */
@Slf4j
@RestController
@RequestMapping("/operationLog")
public class OperationLogController {
    @Autowired
    private IOperationLogService operationLogService;

    @GetMapping
    public Result<PageBean<OperationLog>> getOperationLogList(
            String name, 
            @RequestParam(defaultValue = "1") Integer page, 
            @RequestParam(defaultValue = "10") Integer pageSize){
        log.info("Info level log");
        PageBean<OperationLog> pageBean = operationLogService.getOperationLogList(name, page, pageSize);
        return Result.success(pageBean);
    }

}
